package cn.ruanyun.backInterface.modules.myWeddingInvitation.controller;

import cn.ruanyun.backInterface.common.utils.ResultUtil;
import cn.ruanyun.backInterface.common.vo.PageVo;
import cn.ruanyun.backInterface.common.vo.Result;
import cn.ruanyun.backInterface.modules.base.pojo.DataVo;
import cn.ruanyun.backInterface.modules.myWeddingInvitation.pojo.MyWeddingInvitation;
import cn.ruanyun.backInterface.modules.myWeddingInvitation.service.IMyWeddingInvitationService;
import cn.ruanyun.backInterface.modules.myWeddingInvitation.vo.MyWeddingInvitationVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author z
 * 我的婚礼模板管理接口
 */
@Slf4j
@RestController
@RequestMapping("/ruanyun/myWeddingInvitation")
@Transactional
@Api(tags = "我的婚礼模板")
public class MyWeddingInvitationController {

    @Autowired
    private IMyWeddingInvitationService iMyWeddingInvitationService;


    @PostMapping(value = "/insertOrderUpdateMyWeddingInvitation")
    @ApiOperation("更新或者插入我的婚礼模板")
    public Result<Object> insertOrderUpdateMyWeddingInvitation(MyWeddingInvitation myWeddingInvitation) {

        return iMyWeddingInvitationService.insertOrderUpdateMyWeddingInvitation(myWeddingInvitation);
    }

    @PostMapping(value = "/removeMyWeddingInvitation")
    @ApiOperation("删除我的婚礼模板")
    public Result<Object> removeMyWeddingInvitation(String ids) {

        return iMyWeddingInvitationService.removeMyWeddingInvitation(ids);
    }

    @PostMapping("/getMyWeddingInvitation")
    @ApiOperation("获取我的婚礼模板详情")
    public Result<MyWeddingInvitation> getMyWeddingInvitation(String id) {

        return iMyWeddingInvitationService.getMyWeddingInvitation(id);
    }

    @PostMapping("/getMyWeddingInvitationList")
    @ApiOperation("获取我的婚礼请帖列表")
    public Result<DataVo<MyWeddingInvitationVo>> getMyWeddingInvitationList(PageVo pageVo) {

        return iMyWeddingInvitationService.getMyWeddingInvitationList(pageVo);
    }
}
